From 0598064441c1deb48f8f028bc6a4c65b12ab0a76 Mon Sep 17 00:00:00 2001 From: "robertlipe@gmail.com" Date: Sun, 24 Mar 2013 05:10:32 +0000 Subject: [PATCH] Fix reference counting issues in gdb.cc and waypt.cc exposed by valgrind.Z git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4360 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/gdb.cc | 8 ++++---- gpsbabel/waypt.cc | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gpsbabel/gdb.cc b/gpsbabel/gdb.cc index 09038461d..5efde6f96 100644 --- a/gpsbabel/gdb.cc +++ b/gpsbabel/gdb.cc @@ -1337,15 +1337,15 @@ write_waypoint( /* VERSION DEPENDENT CODE */ if (gdb_ver <= GDB_VER_2) { - char* descr; + QString descr; FWRITE(zbuf, 3); FWRITE(zbuf, 4); descr = (wpt_class < gt_waypt_class_map_point) ? - wpt->url.toUtf8().data() : wpt->description; + wpt->url : wpt->description; if ((descr != NULL) && (wpt_class >= gt_waypt_class_map_point) && \ - (strcmp(descr, wpt->shortname) == 0)) { - descr = NULL; + descr.compare(wpt->shortname) == 0) { + descr.clear(); } FWRITE_CSTR(descr); } else { /* if (gdb_ver > GDB_VER_3) */ diff --git a/gpsbabel/waypt.cc b/gpsbabel/waypt.cc index 2f5b89dc5..3cf5661c6 100644 --- a/gpsbabel/waypt.cc +++ b/gpsbabel/waypt.cc @@ -394,6 +394,9 @@ waypt_free(waypoint *wpt) if (wpt->notes) { xfree(wpt->notes); } + +#if 0 + // these are now ref counted... if (wpt->url_next) { url_link *url_next; @@ -404,6 +407,7 @@ waypt_free(waypoint *wpt) xfree(tonuke); } } +#endif if (wpt->gc_data != &empty_gc_data) { geocache_data *gc_data = (geocache_data *)wpt->gc_data; -- 2.30.2